﻿using System;
using SharpSqlAnalyzer.stmt.oracle;

namespace SharpSqlAnalyzer.nodes
{
	// Token: 0x0200034D RID: 845
	public class TSimpleDmlTriggerClause : TParseTreeNode
	{
		// Token: 0x17000743 RID: 1859
		// (get) Token: 0x060022E7 RID: 8935 RVA: 0x003357DE File Offset: 0x003339DE
		// (set) Token: 0x060022E8 RID: 8936 RVA: 0x003357E6 File Offset: 0x003339E6
		public virtual TDmlEventClause DmlEventClause
		{
			get
			{
				return this.dmlEventClause;
			}
			set
			{
				this.dmlEventClause = value;
			}
		}

		// Token: 0x17000744 RID: 1860
		// (get) Token: 0x060022E9 RID: 8937 RVA: 0x003357EF File Offset: 0x003339EF
		// (set) Token: 0x060022EA RID: 8938 RVA: 0x003357F7 File Offset: 0x003339F7
		public virtual int FireMode
		{
			get
			{
				return this.fireMode;
			}
			set
			{
				this.fireMode = value;
			}
		}

		// Token: 0x060022EB RID: 8939 RVA: 0x00335800 File Offset: 0x00333A00
		public override void init(object arg1, object arg2)
		{
			this.dmlEventClause = (TDmlEventClause)arg1;
			this.before_after_insteadOf = (TDummy)arg2;
			if (this.before_after_insteadOf.ToString().StartsWith("after", StringComparison.Ordinal))
			{
				this.fireMode = 2;
				return;
			}
			if (this.before_after_insteadOf.ToString().StartsWith("before", StringComparison.Ordinal))
			{
				this.fireMode = 1;
				return;
			}
			if (this.before_after_insteadOf.ToString().StartsWith("instead", StringComparison.Ordinal))
			{
				this.fireMode = 3;
			}
		}

		// Token: 0x060022EC RID: 8940 RVA: 0x00335884 File Offset: 0x00333A84
		public override void doParse(TCustomSqlStatement psql, ESqlClause plocation)
		{
			if (psql is TPlsqlCreateTrigger)
			{
				TTable ttable = new TTable();
				ttable.TableType = ETableSource.objectname;
				ttable.TableName = this.dmlEventClause.TableName;
				ttable.EffectType = ETableEffectType.tetTriggerOn;
				psql.tables.addTable(ttable);
			}
		}

		// Token: 0x060022ED RID: 8941 RVA: 0x003358CB File Offset: 0x00333ACB
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x060022EE RID: 8942 RVA: 0x003358DB File Offset: 0x00333ADB
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x04001B1F RID: 6943
		private TDmlEventClause dmlEventClause;

		// Token: 0x04001B20 RID: 6944
		private TDummy before_after_insteadOf;

		// Token: 0x04001B21 RID: 6945
		private int fireMode = 2;
	}
}
